package com.tude._04mybatis.mapper;

import com.tude._04mybatis.pojo.Comment;
import com.tude._04mybatis.pojo.CommentVO;
import com.tude._04mybatis.pojo.CommentVO1;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    @Insert("insert into comment(content,created,user_id,weibo_id) " +
            "values(#{content},#{created},#{userId},#{weiboId})")
    int insert(Comment comment);
    @Update("update comment set content=#{content},created=#{created},user_id=#{userId},weibo_id=#{weiboId} where id=#{id}")
    int updateById(Comment comment);
    @Delete("delete from comment where id=#{id}")
    int deleteById(Integer id);
    @Select("select content, user_id userId, weibo_id weiboId from comment where id=#{id}")
    CommentVO selectCommentById1(Integer id);
    @Select("select content, user_id userId from comment where weibo_id=#{weiboId}")
    List<CommentVO1> selectCommentById2(Integer weiboId);

}
